@extends('admin.layouts.base')

@section('title','控制面板')

@section('pageHeader','控制面板')

@section('pageDesc','DashBoard')

@section('content')

    <div class="row page-title-row" style="margin:5px;">
        <div class="col-md-6">
        </div>
        <div class="col-md-6 text-right">
			<!--<a href="javascript:;" onclick="batchDel()" class="btn btn-danger btn-md" style="">
                <i class="fa fa-minus-circle"></i> 批量删除
            </a>
            <a href="/admin/history/create" class="btn btn-success btn-md">
                <i class="fa fa-plus-circle"></i> 添加操作记录
			</a>-->   
        </div>
    </div>
    <div class="row page-title-row" style="margin:5px;">
        <div class="col-md-6">
        </div>
        <div class="col-md-6 text-right">
        </div>
    </div>

            <div class="row">
                <div class="col-xs-12">
                    <div class="box">

                    @include('admin.partials.errors')
                    @include('admin.partials.success')
                    <div class="box-body">
                    <table id="tags-table" class="table table-bordered table-hover">
                        <thead>
                        <tr>
                            <th data-sortable="false" class="hidden-sm">序号</th>
                            <th class="hidden-sm">操作人</th>
                            <!--<th class="hidden-sm">模型</th>-->
							<th class="hidden-sm">操作类型</th>
							<!--<th class="hidden-sm">被操作id</th>-->
							<th class="hidden-sm">操作内容</th>
							<th class="hidden-sm">操作时间</th>
                        </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                    </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
@stop

@section('js')
    <script>
        $(function () {
            var table = $("#tags-table").DataTable({
                language: {
                    "sProcessing": "处理中...",
                    "sLengthMenu": "显示 _MENU_ 项结果",
                    "sZeroRecords": "没有匹配结果",
                    "sInfo": "显示第 _START_ 至 _END_ 项结果，共 _TOTAL_ 项",
                    "sInfoEmpty": "显示第 0 至 0 项结果，共 0 项",
                    "sInfoFiltered": "(由 _MAX_ 项结果过滤)",
                    "sInfoPostFix": "",
                    "sSearch": "搜索:",
                    "sUrl": "",
                    "sEmptyTable": "表中数据为空",
                    "sLoadingRecords": "载入中...",
                    "sInfoThousands": ",",
                    "oPaginate": {
                        "sFirst": "首页",
                        "sPrevious": "上页",
                        "sNext": "下页",
                        "sLast": "末页"
                    },
                    "oAria": {
                        "sSortAscending": ": 以升序排列此列",
                        "sSortDescending": ": 以降序排列此列"
                    }
                },
				drawCallback: function(){
				　　var api = this.api();
				　　var startIndex= api.context[0]._iDisplayStart;//获取到本页开始的条数
				　　api.column(0).nodes().each(function(cell, i) {
						cell.innerHTML =  (startIndex + i + 1);
				　　}); 
				},
				"iDisplayLength": 100,
                order: [[4, "desc"]],
                serverSide: true,
                ajax: {
                    url: '/admin/history/index',
                    type: 'POST',
                    headers: {
                        'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
                    }
                },
                "columns": [
					{"data":"uname"},
                    /*{"data": "id",render:function(data){ var c = '<label><input class="itemCB" name="itemCB[]" type="checkbox" value="' + data + '"></label><input type="hidden" id="batchDelFormAction" value="/admin/history"><input type="hidden" id="tipTitle" value="操作记录">'; return c;}},*/
                    {"data": "uname",render:function(data){if(data==null){return "<i style='color:red;'>员工已被删</i>";}else{return data;}}},
					/* {"data": "model"}, */
					{"data": "type",render:function(data){
						var d;
						switch(data){
							case 1:
								d = "新增";break;
							case 2:
								d = "删除";break;
							case 3:
								d = "修改";break;
						}
						return d;
					}},
					/*{"data": "aid"},*/
					{"data": "content"},
                    {"data": "created_at"},
                ],
               
            });

            table.on('preXhr.dt', function () {
                loadShow();
            });

            table.on('draw.dt', function () {
                loadFadeOut();
            });

            /* table.on('order.dt search.dt', function () {
                table.column(0, {search: 'applied', order: 'applied'}).nodes().each(function (cell, i) {
                    //cell.innerHTML = cell.innerHTML+(i + 1);
                });
            }).draw(); */


        });
    </script>
@stop